#include <bits/stdc++.h>
using namespace std;

int n, a, b, c, minx, res, o;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin >> n;
    while(cin >> a >> b >> c) {
        res = 0;
        minx = min(min(a, b), c);
        res += minx * 2;
        o = b - minx;
        if(o >= 1) res += (o - 1);
        cout << res << endl;
    }   

    return 0;
}